﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using sixgod.Enum;
using SqlSugar;

namespace sixgod.Model.WorkFlow
{
    /// <summary>
    /// 审核人信息
    /// </summary>
    [SugarTable("AuditPerson")]
    public class AuditPerson:ModelBase
    {
        public AuditPerson(string workFlowId, string nodeId, string userId, string creator)
        {
            base.Create(creator);
            WorkFlowId = workFlowId;
            NodeId = nodeId;
            UserCode = userId;
            AuditTime = null;
        }

        public AuditPerson()
        {
        }

        /// <summary>
        /// 流程ID
        /// </summary>
        public string WorkFlowId { get; set; }
        
        /// <summary>
        /// 意见
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string Opinion { get; set; }

        /// <summary>
        /// 审核时间
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public DateTime? AuditTime { get; set; } = null;


        /// <summary>
        /// 审批结果
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public EnumNodeOperation? Result { get; set; } = null;

        /// <summary>
        /// 节点ID
        /// </summary>
        public string NodeId { get; set; }

        /// <summary>
        /// 审核人
        /// </summary>
        public string UserCode { get; set; }

        [Navigate(NavigateType.ManyToOne,nameof(UserCode))]
        public User.User Person { get; set; }

        /// <summary>
        /// 模型数据验证
        /// </summary>
        /// <returns></returns>
        public override (bool, string) Verify()
        {
            return (false, null);
        }
    }
}
